Channel encoding is used in communication systems to improve data transmission reliability, so as to ensure communication quality. Polar codes, proposed by Professor Arikan of Turkey, are the first kind of codes that are theoretically proven to be able to achieve the Shannon capacity and having low encoding and decoding complexity.
A polar code is a linear block code. An encoding matrix of the polar code is GN, which is an N×N matrix.
An encoding process for generating a polar code x1N=(x1, x2, . . . , xN) is:x1N=u1NGN where u1N=(u1, u2, . . . , uN) is a binary row vector having a length of N bits (N is also called a mother code length), GN is the coding matrix, and GN=F2⊗(log2(N)). F2⊗(log2(N)) is a Kronecker product of a number of log2N matrices F2, and the matrix F2 is:
      F    2    =            [                                    1                                0                                                1                                1                              ]        .  
In the encoding process of the polar code, some bits in the row vector u1N are used to carry information, and these bits are referred to as information bits. An index set of these bits is represented by a set A. Other bits are set to a fixed value that is pre-agreed upon between a receiving end and a transmitting end of the polar code, and these bits are referred to as fixed bits or frozen bits. An index set of the fixed bits or frozen bits is represented by a set Ac, which is a complement set of set A.
The encoding process of the polar code x1N=u1NGN is equivalent to x1N=uAGN(A)⊕uAcGN(Ac). Herein, GN(A) is a submatrix formed by rows in the GN that correspond to indexes in the set A, and GN(Ac) is a submatrix formed by rows in the GN that correspond to indexes in the set Ac. uA is an information bit set of the u1N, and the number of the information bits in the uA is K. uAc is a frozen bit set of the u1N, and the number of the frozen bits in the uAc is N−K. The frozen bits are known bits. Value of the frozen bits is normally set to 0, but the value of the frozen bits may be randomly set, provided that the receiving end and the transmitting end of the polar code have pre-agreed on the value of the frozen bits. When the frozen bits are set to 0, a polar code encoding output may be simplified as x1N=uAGN(A), in which GN(A) is a K×N matrix.
A process of constructing a polar code is a process of selecting the set A, and the selection of the set A determines the performance of the polar code. The process of constructing the polar code normally includes: determining, based on a mother code length N, that a total of N polarized channels exist, where each of the polarized channels corresponds to one row in an encoding matrix, respectively; calculating a reliability of each of the polarized channels; forming the information bit index set A using indexes of first K polarized channels with relatively high reliabilities, and forming the frozen bit index set Ac using indexes of the remaining (N−K) polarized channels. The set A determines bit positions of the information bits in x1N, and the set Ac determines bit positions of the frozen bits in x1N.
It can be learned from the encoding matrix that a code length of an original polar code (mother code) is an integer power of 2. In practical applications, however, length of a polar code need to be set to any code length, and this is achieved by a process called rate matching.
In the prior art, a puncturing or a shortening manner is used for rate matching. A mother code whose length exceeds a target code length is usually punctured or shortened, to achieve the target code length. The punctured or shortened code is filled during decoding, to restore to the length of the mother code. Buffer sizes, complexity, and delays during the encoding and the decoding are related to the mother code length. When a relatively large quantity of bits are shortened or punctured (for example, the mother code is shortened or punctured from 2048 bits to 1200 bits), additional overheads due to the puncturing are quite high. An increase in the target code length results in a decrease in a code rate. On the one hand, this may bring an encoding gain; on the other hand, the complexity also increases as the mother code length increases.